"""Remove password_hash from the primary key.

Revision ID: 5080f751f7d0
Revises: 39ce3b205482
Create Date: 2021-03-04 15:05:29.091109

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "5080f751f7d0"
down_revision = "39ce3b205482"
branch_labels = None
depends_on = None


def upgrade():
    op.execute("ALTER TABLE users DROP CONSTRAINT pk_users")
    op.create_primary_key("pk_users", "users", ["uuid", "username"])


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "users", "password_hash", existing_type=sa.VARCHAR(length=255), nullable=False
    )
    # ### end Alembic commands ###
